package com.verify.emun;

import com.verify.func.TwoConsumer;
import com.verify.util.R;
import com.verify.service.ExcelVerifyService;

import java.io.File;
import java.util.Map;

public enum ExcelVerifyMethod {
    VERIFY_TABLE_1((service, file, map) -> service.verifyTable1(file, map)),  // 使用实例方法引用
    VERIFY_TABLE_2((service, file, map) -> service.verifyTable2(file, map)),  // 使用实例方法引用

    VERIFY_TABLE_3((service, file, map) -> service.verifyTable3(file, map)),  // 使用实例方法引用

    VERIFY_TABLE_4((service, file, map) -> service.verifyTable4(file, map)),

    VERIFY_TABLE_5((service, file, map) -> service.verifyTable5(file, map)),
    VERIFY_TABLE_6((service, file, map) -> service.verifyTable6(file, map)),
    VERIFY_TABLE_7((service, file, map) -> service.verifyTable7(file, map)),
    VERIFY_TABLE_8((service, file, map) -> service.verifyTable8(file, map)),

    VERIFY_TABLE_9((service, file, map) -> service.verifyTable9(file, map)),
    AREA((service, file, map) -> service.areaInit(file, map)),
    ;  // 使用实例方法引用;  // 使用实例方法引用
    private final TwoConsumer<ExcelVerifyService, File, Map<String, String>> method;

    // 构造函数
    ExcelVerifyMethod(TwoConsumer<ExcelVerifyService, File, Map<String, String>> method) {
        this.method = method;
    }

    // 执行方法
    public R execute(ExcelVerifyService service, File file, Map<String, String> params) {
        return method.accept(service, file, params); // 调用方法引用
    }

    public static ExcelVerifyMethod getExcelMethod(String methodName) {
        return ExcelVerifyMethod.valueOf(methodName.toUpperCase());
    }
}
